package com.junsi.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.junsi.bean.CompactGenre;
import com.junsi.mapper.CompactGenreMapper;
import com.junsi.service.CompactGenreService;

@Service
@Transactional(rollbackFor = Exception.class)
public class CompactGenreServiceImpl implements CompactGenreService{
	@Autowired
	private CompactGenreMapper compactGenrtMapper;

	@Override
	public List<CompactGenre> listAll() {
		List<CompactGenre> list = compactGenrtMapper.listAll();
		return list;
	}

	@Override
	public CompactGenre findById(Integer id) {
		CompactGenre compactGenre = compactGenrtMapper.findById(id);
		return compactGenre;
	}

	@Override
	public boolean insert(CompactGenre o) throws Exception {

		int result = compactGenrtMapper.insert(o);
		if (result == 1) {
			return true;
		} else {
			return false;
		}

	}

	@Override
	public boolean update(CompactGenre o) throws Exception {
		int result = compactGenrtMapper.update(o);
		if (result == 1) {
			return true;
		} else {
			return false;
		}
	}

	@Override
	public boolean delete(Integer id) {
		int result = compactGenrtMapper.delete(id);
		if (result == 1) {
			return true;
		} else {
			return false;
		}

	}

}
